<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>Vue中的过渡列表</title>
		<script type="text/javascript" src="js/vue.js" ></script>
		<style>
			.v-enter, .v-leave-to {
				opacity: 0;
			}
			.v-enter-active, .v-leave-active {
				transition: opacity 1s;
			}
		</style>

	</head>
	<body>
		<div id="root">
			<transition-group>
				<div v-for="item of list" :key="item.id">
					{{item.title}}
				</div>
			</transition-group>
        	<button @click="handleBtnClick">add</button>
        </div>
		
		<script>
			
			var vm = new Vue({
				el: '#root',
				data: {
					count: 0,
					list: []
				},
				methods: {
					handleBtnClick: function() {
						this.list.push({
							id: this.count++,
							title: "hello world"
						})	
					}
					
				}
			})
			
		</script>
	</body>
</html>
